package com.agricultural.machine.command;

import com.agricultural.machine.common.IMachine;

/**
 * 机器任务命令类 - 命令模式
 */
public class MachineTaskCommand implements TaskCommand {
    private final IMachine machine;
    private final String taskDescription;
    
    public MachineTaskCommand(IMachine machine, String taskDescription) {
        this.machine = machine;
        this.taskDescription = taskDescription;
    }
    
    @Override
    public void execute() {
        System.out.println("执行任务: " + taskDescription + " 在农机 " + machine.getMachineId());
        machine.executeTask(taskDescription);
    }
    
    @Override
    public void undo() {
        System.out.println("撤销任务: " + taskDescription + " 在农机 " + machine.getMachineId());
        machine.stop();
    }
    
    @Override
    public String getDescription() {
        return "农机任务 [农机ID=" + machine.getMachineId() + ", 任务=" + taskDescription + "]";
    }
} 